<template>
  <div>
    <div @click="handleChangeCity">changeCity</div>
    <div>{{this.city}}</div>
  </div>
</template>

<script>
import { mapState, mapActions } from 'vuex'
export default {
  name: 'Example',
  computed: {
    ...mapState({
      city: 'city'
    })
  },
  methods: {
    handleChangeCity () {
      this.changeCity('北京')
    },
    ...mapActions(['changeCity'])
  }
}
</script>
